package com.itheima.test;

import com.itheima.domain.User;

import java.util.ArrayList;
import java.util.Scanner;

public class UserManager {
    public static void main(String[] args) {
        //使用Scanner对象实现键盘录入
        Scanner sc = new Scanner(System.in);
        //定义一个容器,用于存储用户对象,方便增删改查
        ArrayList<User> list = new ArrayList<>();


        while(true){
            //用户提示
            System.out.println("============================");
            System.out.println("欢迎来到用户管理系统:");
            System.out.println("本系统有以下功能选项");
            System.out.println("1.查询功能");
            System.out.println("2.增加功能");
            System.out.println("3.修改功能");
            System.out.println("4.删除功能");
            System.out.println("5.退出系统");
            System.out.println("请输入:");
        int choice = sc.nextInt();
        switch(choice){
            case 1:
                findUser(list);
                break;
            case 2:
                addUser(list);
                break;
            case 3:
                upDateUser(list);
                break;
            case 4:
                deleteUser(list);
                break;
            case 5:
                System.out.println("退出成功");
                break;

        }

        }











    }

    private static void deleteUser(ArrayList<User> list) {

    }

    private static void upDateUser(ArrayList<User> list) {

    }

    private static void addUser(ArrayList<User> list) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户id");
        int id = sc.nextInt();
        System.out.println("请输入用户姓名");
        String name = sc.next();
        System.out.println("请输入用户年龄");
        int age = sc.nextInt();
        System.out.println("请输入用户生日");
        String birthday = sc.next();
        User us = new User(id,name,age,birthday);
        list.add(us);
        System.out.println("增加成功");
    }

    private static void findUser(ArrayList<User> list) {

        for (int i = 0; i < list.size(); i++) {
            list.get(i).show();
            System.out.println();
        }


    }


}
